import  QGuanRunApplication from "./qguan.js"
import RootLoad from "./root/RootLoad.js";
import Rx from "../../qbasics/abstract/Rx.js";

import  AopFactory from "./AopFactory.js"
import  jsrLoad from "./load/jsrLoad.js"
import  AppRun from "./decorator/AppRun"
import  DefaultLoad  from  "./load/DefaultLoad.js"
import Preloading from "./load/Preloading";
import SyncJsLoad from "./load/SyncJsLoad";
const path = require('path');
const fs = require('fs');

let apackPath=path.join(__dirname,'../../../../');
let packtmp= fs.readFileSync(path.join(apackPath,'/tmp/pack1.tmp') ,'utf-8' );   //临时文件
let packList=packtmp.split("\r\n");
let patmp0=packList[0].split(",")
let patmp1=packList[1].split(",")

const inBrowser = typeof window !== 'undefined'
new QGuanRunApplication()
let   root =     RootLoad(inBrowser,patmp0[0]);
root.then((root1)=>{

    qguan('appRun',AppRun,null,"save");
    qguan('root',root1,null,"save");
    qguan('rx',Rx,null,"save");
    let aopFactory=new AopFactory();
    qguan("aopFactory",aopFactory,null,"save");
    qguan('comm',patmp1,null,"save")
    qguan("jsrLoad",jsrLoad,null,"save");
    qguan("defaultLoad",DefaultLoad,null,"save")
     let syncjsLoad= new SyncJsLoad();
    qguan("syncJsLoad",syncjsLoad,null,"save")
    let preloading=new  Preloading();
    let res= preloading.run("qguan")
    res.then(()=>{
        qguan('qguan',"",'qguan.js','jsrLoad')

    })
})
